<?php
if (!defined('URL')) include('../includes/definer.php');
if (!defined('BOOTSTRAP')) include(INC.'admin/php/bootstrap.php');
$conn->exec("SET lc_time_names = 'es_ES'");
$meses = Doctrine_Query::create()
        ->select('DATE_FORMAT(p.publicado, "%M %Y") as mes')
        ->from('Publicacion p')
        ->where('p.id_estado = '.Estado::VISIBLE)
        ->groupBy('mes')
        ->orderBy('p.created_at asc')
        ->execute(array(), Doctrine::HYDRATE_ARRAY)
;
$html = file_get_contents(INC.'tpl/selectMes.tpl');
$mesesHtml = '';
foreach ($meses as $mes) {
    $mesesHtml .= '<option value="'.strtolower($mes['mes']).'">'.ucwords($mes['mes']).'</option>';
}
$html = str_replace('${meses}', $mesesHtml, $html);
echo($html);
?>